package com.wudimeng.syll.controller.api;


import com.wudimeng.syll.common.ApiResponse;
import com.wudimeng.syll.constants.Constant;
import com.wudimeng.syll.entity.CRuKuXinXi;
import com.wudimeng.syll.service.ICRuKuXinXiService;
import com.wudimeng.syll.service.IXingZhengQuYuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author laohei
 * @Date 2020/6/8 9:50
 * @Version 1.0
 */
@RestController
@Slf4j
@RequestMapping("syll")
public class XingZhengQuYuController {

    @Autowired
    private IXingZhengQuYuService service;

    @GetMapping("/Province")
    public ApiResponse getProvince(HttpServletRequest  request){
        try {
            return this.service.selectProvince(null);
        } catch (Exception e) {
            log.error("IXingZhengQuYuService.Province.请稍后再试:" + e.getMessage());
            return ApiResponse.error(Constant.COMMON_PARAMETER_DEGRADE);
        }
    }


    @GetMapping("/xzqy")
    public ApiResponse gettXzqy(HttpServletRequest request){
        try {
            Map<String,String> map = new HashMap<>();
            map.put("pid",request.getParameter("pid"));
            return service.selectXzqy(map);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponse.error(Constant.COMMON_OPERATE_FAIL);
        }
    }

}
